import React from "react";
import BaseComponent from "../../redare/components/BaseComponent";
import {Card, Descriptions, PageHeader} from "antd";
import OnlFormHeadPresenter from "../../.gen/presenter/OnlFormHeadPresenter";
import {WebPage} from "../../redare_components/webplatform_workbench/utils/WorkbenchDecoratorUtil";

const routes = [
    {
        path: '/',
        breadcrumbName: '首页'
    },
    {
        path: '/onlformhead/info',
        breadcrumbName: '详情'
    }
];

export default @WebPage({
    id: 'com.redare.devframework.webplatform.pages.onlformhead.OnlFormHeadInfoPage',
    name: '表单详情',
    webPath: '/onlformhead/info'
})
class OnlFormHeadInfoPage extends BaseComponent {


    constructor(props) {
        super(props);
        this.presenter = new OnlFormHeadPresenter(this);
    }

    componentDidMount() {
        let {id} = this._urlQuery
        if (id) {
            this.showSpin()
            this.presenter.getOnlFormHead({id}, {}, (result) => {
                if (result) {
                    this.setState({data: result.data})
                }
            })
        }
    }

    render() {
        let {data} = this.state;
        if (!data) {
            data = {};
        }
        return (
            <div>
                <PageHeader onBack={() => this._onBack()} className="margin-bottom bg-white"
                            title='详情' routes={routes}/>
                {this.renderSpin(
                    <Card bordered={false} className="margin24">
                        <Descriptions>
                            <Descriptions.Item label="系统id">{data.sysId}</Descriptions.Item>
                            <Descriptions.Item label="表名">{data.tableName}</Descriptions.Item>
                            <Descriptions.Item label="表类型: 0单表、1主表、2附表">{data.tableType}</Descriptions.Item>
                            <Descriptions.Item label="表版本">{data.tableVersion}</Descriptions.Item>
                            <Descriptions.Item label="表说明">{data.tableTxt}</Descriptions.Item>
                            <Descriptions.Item label="是否带checkbox">{data.isCheckbox}</Descriptions.Item>
                            <Descriptions.Item label="同步数据库状态">{data.isDbSynch}</Descriptions.Item>
                            <Descriptions.Item label="是否分页">{data.isPage}</Descriptions.Item>
                            <Descriptions.Item label="是否是树">{data.isTree}</Descriptions.Item>
                            <Descriptions.Item label="主键生成序列">{data.idSequence}</Descriptions.Item>
                            <Descriptions.Item label="主键类型">{data.idType}</Descriptions.Item>
                            <Descriptions.Item label="查询模式">{data.queryMode}</Descriptions.Item>
                            <Descriptions.Item label="映射关系 0一对多  1一对一">{data.relationType}</Descriptions.Item>
                            <Descriptions.Item label="子表">{data.subTableStr}</Descriptions.Item>
                            <Descriptions.Item label="附表排序序号">{data.tabOrderNum}</Descriptions.Item>
                            <Descriptions.Item label="树形表单父id">{data.treeParentIdField}</Descriptions.Item>
                            <Descriptions.Item label="树表主键字段">{data.treeIdField}</Descriptions.Item>
                            <Descriptions.Item label="树开表单列字段">{data.treeFieldname}</Descriptions.Item>
                            <Descriptions.Item label="表单分类">{data.formCategory}</Descriptions.Item>
                            <Descriptions.Item label="PC表单模板">{data.formTemplate}</Descriptions.Item>
                            <Descriptions.Item label="表单模板样式(移动端)">{data.formTemplateMobile}</Descriptions.Item>
                            <Descriptions.Item label="是否有横向滚动条">{data.scroll}</Descriptions.Item>
                            <Descriptions.Item label="复制版本号">{data.copyVersion}</Descriptions.Item>
                            <Descriptions.Item label="复制表类型1为复制表 0为原始表">{data.copyType}</Descriptions.Item>
                            <Descriptions.Item label="原始表ID">{data.physicId}</Descriptions.Item>
                            <Descriptions.Item label="扩展JSON">{data.extConfigJson}</Descriptions.Item>
                            <Descriptions.Item label="修改人">{data.updateBy}</Descriptions.Item>
                            <Descriptions.Item label="创建人">{data.createBy}</Descriptions.Item>
                            <Descriptions.Item label="主题模板">{data.themeTemplate}</Descriptions.Item>
                            <Descriptions.Item label="是否用设计器表单">{data.isDesForm}</Descriptions.Item>
                            <Descriptions.Item label="设计器表单编码">{data.desFormCode}</Descriptions.Item>
                        </Descriptions>
                    </Card>
                )}
            </div>
        )
    }

    _onBack() {
        this.routeBack(this.props.history)
    }

    showLoadingIndicator(text, options = {}) {
        this.showSpin(text, options);
    }

    closeLoadingIndicator() {
        this.closeSpin();
    }
}





